<?php

namespace app\common\validate\virtual;

use yiqiniu\extend\validate\YqnValidate;

//活动确认订单
class VirtualScanTempLogValid extends YqnValidate
{
    /**
     *  验证规则
     */
    protected $rule = [
        'order_no' => 'require',
        'vp_id' => 'require|dbExists:virtual_promo,id',
        'product_code' => 'require|dbExists:product,code',
    ];


    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
        'order_no.require' => '订单号不能为空',
        'order_no.dbExists' => '订单不存在',
        'vp_id.require' => '活动不能为空',
        'vp_id.dbExists' => '活动不存在',
        'product_code.require' => '商品编码不能为空',
        'product_code.dbExists' => '商品编码不存在',
    ];

    //验证场景
    protected $scene = [
        'add_order' => ['vp_id' , 'product_code'],
        'append_product' => ['order_no' , 'product_code'],
        'virtual_list' => ['order_no']
    ];
}
